$(function(){
	
	var url = decodeURI(window.location.href.split("?")[1]);
	//alert(window.location.href.split("?")[1])
	if(url == undefined){
		alert("去首页")
	}
	
	
	var param = url.split("positionId=")[1];
	//alert(param)
	
	if(param == undefined || param == ""){
		//location.href="index.html"
	}
	$.ajax({
		url:path+'companyPosition/selectPositionById',
		type:'POST',
		data:JSON.stringify({"positionId": param}),
		dataType:'json',
		crossDomain: true,
		xhrFields: {
		withCredentials: true
		},
		async: false,
		contentType: 'application/json'
	}).done(function(data){
		if(data.result != undefined){
			var d = data.result
			
			$("#positionId").val(d.id)
			$("#positionType").val(d.positionType)
			$("#select_category").val(d.positionType)
			$("#positionName").val(d.positionName)
			$("#department").val(d.department)
			if(d.jobNature == "全职"){
				$("#one").addClass("current")
				$("#oneNature").attr("checked", "ture")
			}else if(d.jobNature == "兼职"){
				$("#two").addClass("current")
				$("#twoNature").attr("checked", "ture")
			}else if(d.jobNature == "实习"){
				$("#three").addClass("current")
				$("#threeNature").attr("checked", "ture")
			}
			$("#salaryMin").val(d.salaryMin)
			$("#salaryMax").val(d.salaryMax)
			$("#workAddress").val(d.workAddress)
			$("#select_experience").val(d.workYear)
			$("#experience").val(d.workYear)
			$("#positionAdvantage").val(d.positionAdvantage)
			$("#positionDetail").val(d.positionDetail)
			$("#positionAddress").val(d.positionAddress)
			$("#select_education").val(d.education)
			$("#education").val(d.education)
			
			// <input type="hidden" id="positionType" value="" name="positionType">
			// <input type="button" value="请选择职位类别" id="select_category" class="selectr selectr_380">
			// <input type="text" placeholder="请输入职位名称，如：产品经理" value="" name="positionName" id="positionName">
			// <input type="text" placeholder="请输入所属部门" value="" name="department" id="department">
			// <li id="one">
			// 	全职<em></em>
			// 	<input type="radio" name="jobNature" value="全职">
			// </li>
			// <li id="two">
			// 	兼职<em></em>
			// 	<input type="radio" name="jobNature" value="兼职">
			// </li>
			// <li id="three">
			// 	实习<em></em>
			// 	<input type="radio" name="jobNature" value="实习">
			// </li>
			// <input type="text" placeholder="最低月薪" value="" id="salaryMin" name="salaryMin">
			// <input type="text" placeholder="最高月薪" value="" id="salaryMax" name="salaryMax">
			// <input type="text" placeholder="请输入工作城市，如：北京" value="上海" name="workAddress" id="workAddress">
			// <input type="hidden" id="experience" value="" name="workYear">
			// <input type="button" value="请选择工作经验" id="select_experience" class="selectr selectr_380">
			// <input type="hidden" id="education" value="" name="education">
			// <input type="button" value="请选择学历要求" id="select_education" class="selectr selectr_380">
			// <input type="text" placeholder="20字描述该职位的吸引力，如：福利待遇、发展前景等" value="" name="positionAdvantage" class="input_520"
			//  id="positionAdvantage">
			// <textarea name="positionDetail" id="positionDetail"></textarea>
			// <input type="text" placeholder="请输入详细的工作地址" value="" name="positionAddress" class="input_520" id="positionAddress">
			// <input type="hidden" value="" name="positionLng" id="lng">
			// <input type="hidden" value="" name="positionLat" id="lat">
			
		}else{
			alert(data.msg)
		}
	})
	
})